import { TAB_TYPE_CURRENT_POSITION } from '../actions/tradeDataQueryAction'
import { fromJS } from 'immutable'

export const TRADE_DATA_QUERY_ACTION = 'trade_data_query_action'

const initialState = fromJS({
  currentDataQueryType: TAB_TYPE_CURRENT_POSITION,
  positionLoading: true,
  positionList: [],
  currentOrderLoading: true,
  currentOrderCurrentPage: 1,
  currentOrderTotalPage: 1,
  currentOrderList: [],
  historyOrderLoading: true,
  historyOrderCurrentPage: 1,
  historyOrderTotalPage: 1,
  historyOrderList: []
})

export default (state = initialState, action) => {
  if (action.type === TRADE_DATA_QUERY_ACTION) {
    return state.merge(action.data)
  }
  return state
}
